//
//  ImageDownloader.h
//  FrameTest
//
//  Created by Tiger on 11-11-2.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ImageCache.h"

@protocol ImageDownloaderDelegate <NSObject>

@optional
- (void)imageDidFinishLoad:(UIImage *)image indexPath:(NSIndexPath *)indexPath;
- (void)imageDidFinishLoad:(UIImage *)image index:(NSInteger)index;

@end


@interface ImageDownloader : NSObject {

	NSString *imageUrl;
	NSIndexPath *indexPath;
    NSInteger _index;
	id<ImageDownloaderDelegate> delegate;
	NSMutableData *imageData;
	NSURLConnection *conn;
}

@property(nonatomic,assign) id<ImageDownloaderDelegate> delegate;

- (void)cancel;
- (id)initWithUrl:(NSString *)strUrl indexPath:(NSIndexPath *)index;
- (id)initWithUrl:(NSString *)strUrl index:(NSInteger)index;
- (UIImage *)getImage;

@end
